﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace MobileControlGuru.AutoTask
{
    public partial class OperateVariableItem : UserControl
    {
        public delegate void DeleteVariableTemp(int index);
        public int Index;
        public DeleteVariableTemp deleteVariableTempEevnt { get; set; }
        public OperateParam param;
        public int MaxAmount;
        public OperateVariableItem()
        {
            InitializeComponent();
        }

        public OperateVariableItem(OperateParam item)
        {
            this.param = item;
            InitializeComponent();
            if (this.param != null)
            {
                this.inputTempParams.Text = this.param.TempParam;
                this.inputNumberAmount.Text = this.param.Amount.ToString();
                this.inputNumberAmount.Value = this.param.Amount;
            }
         
        }

        private void OperateVariableItem_Load(object sender, EventArgs e)
        {
            if (this.MaxAmount > 0)
            {
                this.inputNumberAmount.Maximum = this.MaxAmount;
            }
        
               
        }
        public void SetIndex(int index)
        {
            Index = index;
            //this.label1.Text = "操作：" + index.ToString();
        }
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            deleteVariableTempEevnt(Index);
            this.Dispose();
        }
    }
}
